package com.foreverwin.mes.meapi.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.meapi.model.Certification;
import com.foreverwin.mes.meapi.model.UserCert;
import com.foreverwin.mes.meapi.mapper.UserCertMapper;
import com.foreverwin.mes.meapi.service.UserCertService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Syngna
 * @since 2020-01-14
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserCertServiceImpl extends ServiceImpl<UserCertMapper, UserCert> implements UserCertService {


    @Autowired
    private UserCertMapper userCertMapper;

    @Override
    public Page<UserCert> selectPage(FrontPage<UserCert> frontPage, UserCert userCert) {
        EntityWrapper<UserCert> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(userCert);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<UserCert> selectList(UserCert userCert) {
        EntityWrapper<UserCert> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(userCert);
        return super.selectList(queryWrapper);
    }

    @Override
    public List<Certification> getCertByUserBo(String userBo) {
        return userCertMapper.selectCertByUserBo(userBo);
    }
}